import { createApp } from 'vue'
import './style/index.scss'
import App from './App.vue'

//引入仓库pinia
import pinia from './store';
import router from './router'
// 引入自定义工具
import commonUtils from '../src/utils/commonUtils.ts'
import * as Icons from '@ant-design/icons-vue'
//echarts
import ECharts from 'vue-echarts' // 在 webpack 环境下指向 components/ECharts.vue

// 手动引入 ECharts 各模块来减小打包体积
import 'echarts/lib/chart/bar'
import 'echarts/lib/component/tooltip'
// 如果需要配合 ECharts 扩展使用，只需要直接引入扩展包即可
// 以 ECharts-GL 为例：
// 需要安装依赖：npm install --save echarts-gl，并添加如下引用
import 'echarts-gl'
import * as echarts from 'echarts';
//注册loading组件
// import Loading from '@/view/components/Loading/index.vue'
import Loading from '../src/view/components/loading/index.vue'
//注册验证码组件
import './router/guard.ts'
const app = createApp(App)
app.config.globalProperties.commonUtils = commonUtils;
// element-plus icon
//注册icon
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.component('v-chart', ECharts)
app.component('Loading',Loading)
app.use(router)
app.use(pinia)
app.mount('#app')

// 全局使用图标，遍历引入
const icons: any = Icons
for (const i in icons) {
    app.component(i, icons[i])
}
